#ifndef P3_OPERATOR_H
#define P3_OPERATOR_H

#ifndef P3LIBAPI
#define P3LIBAPI extern "C" __declspec(dllimport)
#endif

//P3LIBAPI int __stdcall P3_StartUp(const char* moduleList);


P3LIBAPI const char* __stdcall P3_GetConnectionInfo(int index);

//P3LIBAPI const char* __stdcall P3_GetModuleState(int index);

P3LIBAPI int __stdcall P3_GetOperatorState(void);

P3LIBAPI int __stdcall P3_Startup(const char* moduleList);

P3LIBAPI int __stdcall P3_Shutdown(void);

P3LIBAPI int __stdcall P3_Initialize(void);

P3LIBAPI int __stdcall P3_Dispose(void);

P3LIBAPI int __stdcall P3_SetConfig(void);

P3LIBAPI int __stdcall P3_StartRun(void);

P3LIBAPI int __stdcall P3_StopRun(void);

P3LIBAPI int __stdcall P3_ReleaseObject(const char*);


enum BCI_State
{
	P3_StateUnavailable,
	P3_StateStartup,
	P3_StateConnected,
	P3_StateResting,
	P3_StateRunning,
	P3_StateBusy,
	P3_StateIdle,
};


/*
Enumeration of callback events.
Event handler arguments are given following the event.
*/
enum P3_Event
{
	P3_None = -1,

	P3_OnSystemStateChange = 0, /* ( void* refdata ) */
	P3_OnCoreInput,             /* ( void* refdata ) */

	P3_OnConnect,   /* ( void* refdata ) */
	P3_OnSetConfig, /* ( void* refdata ) */
	P3_OnStart,     /* ( void* refdata ) */
	P3_OnSuspend,   /* ( void* refdata ) */
	P3_OnResume,    /* ( void* refdata ) */
	P3_OnShutdown,  /* ( void* refdata ) executed when closing connections */

	P3_OnLogMessage,     /* ( void* refdata, const char* msg ) */
	P3_OnWarningMessage, /* ( void* refdata, const char* msg ) */
	P3_OnErrorMessage,   /* ( void* refdata, const char* msg ) */
	P3_OnDebugMessage,   /* ( void* refdata, const char* msg ) */

	P3_OnParameter,          /* ( void* refdata, const char* parameterline ) */
	P3_OnState,              /* ( void* refdata, const char* stateline ) */
	P3_OnVisPropertyMessage, /* ( void* refdata, const char* name, int cfgID, const char* value ) */
	P3_OnVisProperty,        /* ( void* refdata, const char* name, int cfgID, const char* value ) */

	P3_OnInitializeVis, /* ( void* refdata, const char* visID, const char* kind ) */
	P3_OnVisMemo,       /* ( void* refdata, const char* visID, const char* msg ) */
	P3_OnSignal,     /* ( void* refdata, const char* visID, int channels, int elements, float* data ) */
	P3_OnVisBitmap,     /* ( void* refdata, const char* visID, int width, int height, unsigned short* data ) */

	P3_OnUnknownCommand, /* int ( void* refdata, const char* command ) */
	P3_OnScriptError,    /* ( void* refdata, const char* msg ) */
	P3_OnScriptHelp, /* ( void* refdata, const char** help ) */

	P3_OnQuitRequest, /* ( void* refdata, const char** message ) executed when a script executes the QUIT command */

	P3_NumEvents
};

enum P3_Result
{
	P3_NotHandled = 0,
	P3_Handled = 1,
};

// call back function pointer type
typedef int (__stdcall *P3_Function)(void);

P3LIBAPI int __stdcall P3_SetCallback(long, P3_Function, void*);

P3LIBAPI int __stdcall P3_SetExternalCallback(long, P3_Function, void*);

P3LIBAPI int __stdcall P3_CheckPendingCallback();	

P3LIBAPI P3_Function __stdcall P3_GetCallbackFunction(long);

P3LIBAPI void* __stdcall P3_GetCallbackData(long);

P3LIBAPI int __stdcall P3_GetCallbackIsExternal(long);


#endif